home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGBLER / ASMCODE.LZH / READCHAR.ASM < prev    next >
Assembly Source File  |  1984-06-01  |  2KB  |  39 lines

  1. page,132
  2. name keyboard_code
  3. title keyboard.asm   --  Procedure to mask input to read
  4. ;
  5. ;
  6. ;
  7. ;
  8. keyboard_code segment   para public 'code'
  9.               assume    cs:keyboard_code
  10.               public    keyboard            ;pass name to linker
  11. keyboard      proc      far                 ;pascal calls are far
  12.               push      bp                  ;save the base pointer
  13.               cli                           ;stop interuppts
  14. lock          mov       bp,sp               ;get the stack offset
  15. lock          mov       bx,[bp]+10          ;get addr of string
  16. lock          mov       dx,[bp]+8           ;get addr of length
  17. lock          mov       si,[bp]+6           ;get number to read max
  18.               mov       cx,si               ;save the limit for input
  19.               mov       di,00               ;start at char number 1
  20.               sti                           ;start interrupts
  21. get_key:
  22.               mov       ah,0                ;call bios for read service
  23.               int       16h                 ;call bios
  24.               cmp       al,0dh              ;see if this is the cr char
  25.               je        quit                ;exit if so else continue
  26.               mov       [bx][di],al         ;get char into parm area
  27.               inc       di
  28.               mov       ah,14               ;load for bios service
  29.               int       10h                 ;bios service to display and move cursor
  30. loop          get_key                       ;loop until di=cx=30 or find a cr (0dh)
  31. quit:                                       ;found the end of line
  32.               mov       bx,dx               ;get address back of length  param
  33.               mov       [bx],di             ;move number of reads to count
  34.               pop       bp                  ;restore the frame pointer
  35.               ret       6                   ;cleanup stack
  36. keyboard      endp
  37. keyboard_code ends
  38.               end                           ;end assembly
  39.